//
//  scrollview.m
//  UI09_flim
//
//  Created by dllo on 16/6/16.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "scrollview.h"

@implementation scrollview

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        
        [self setProtertys];
        
        
    }
    return self;
}
-(void)setProtertys{
        self.contentSize = CGSizeMake(1000, 0);
        self.pagingEnabled = YES;
    self.showsVerticalScrollIndicator = NO; 
    self.showsHorizontalScrollIndicator = NO;
    
}
-(void)addPictures:(NSArray<UIImage *> *)pictureArray{
    self.contentSize = CGSizeMake(CGRectGetWidth(self.bounds) * pictureArray.count, CGRectGetHeight(self.bounds));
    for (int i = 0; i < pictureArray.count; i++) {
        
        
        UIScrollView *ScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(i * CGRectGetWidth(self.bounds), 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds))];
        
      
        UIImageView *imageView = [[UIImageView alloc] initWithImage:pictureArray[i]];
        
        
        imageView.frame = ScrollView.bounds;
        
        [ScrollView addSubview:imageView];
        [self addSubview:ScrollView];
        
        [imageView release];
        [ScrollView release];
    }
    

    
    
    
}

@end
